package com.quectel.core.module.household.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.quectel.core.module.household.entity.HouseholdEntity;
import com.quectel.core.module.household.entity.HouseholdRoomEntity;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * @author caolu
 * @email louis.cao@quectel.com
 * @date 2021-11-02 13:12:13
 */

public interface HouseholdRoomDao extends BaseMapper<HouseholdRoomEntity> {
    /**
     * 查询列表
     *
     * @param params
     * @return
     */
    List<HouseholdRoomEntity> queryList(Map<String, Object> params);

    /**
     * 查询数量
     *
     * @param params
     * @return
     */
    int queryTotal(Map<String, Object> params);

    @Select("<script>select h.* from household_room hr inner join household h on hr.household_id = h.id where hr.room_id = #{villageRoomId}" +
            "</script>")
    List<HouseholdEntity> selectCohabitantList(@Param("villageRoomId") Long villageRoomId);
}
